package com.example.shiro01.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.shiro01.dao.UserDao;
import com.example.shiro01.pojo.User;
import com.example.shiro01.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImp implements UserService {


    @Autowired
    private UserDao userDao;
    @Override
    public User denglu(String name) {

        LambdaQueryWrapper<User> lqw=new LambdaQueryWrapper();
        lqw.eq(name!=null,User::getUsername,name);
        return userDao.selectOne(lqw);
    }

    @Override
    public int addUser(String name, String pwd) {
        User user=new User();
        user.setUsername(name);
        user.setUserpwd(pwd);
        user.setPerms("user:add");
        return userDao.insert(user);
    }
}
